﻿<UserControl x:Class="Skynet.C2SModule.Views.AuthorsDSMgmt.AuthorView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:sys="clr-namespace:System;assembly=mscorlib"             
             xmlns:patterns="clr-namespace:Infrastructure.Aspect.Patterns;assembly=Infrastructure.Aspect"
                     
             mc:Ignorable="d" 
             d:DesignHeight="500" d:DesignWidth="500" xmlns:my="clr-namespace:Skynet.C2SModule.Models" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <!--
        <presenters:AuthorDSViewPresenter  x:Key="Presenter"></presenters:AuthorDSViewPresenter>             
        
        <local:TestObject x:Key="testid"></local:TestObject>
        <my:SkynetLibraryDS x:Key="skynetLibraryDS" />
        <CollectionViewSource x:Key="authorsViewSource" Source="{Binding Path=Authors, Source={StaticResource skynetLibraryDS}}" />
        <CollectionViewSource x:Key="authorsBooksViewSource" Source="{Binding Path=FK_AuthorBook, Source={StaticResource authorsViewSource}}" />
        -->
        
    </UserControl.Resources>
    <Grid >
        <Grid DataContext="{StaticResource Presenter}">
            <TextBlock Text="{Binding Path=Nombre}"></TextBlock>
        </Grid>
        <Grid DataContext="{StaticResource authorsViewSource}" HorizontalAlignment="Left" Margin="37,28,0,0" Name="grid1" VerticalAlignment="Top">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Label Content="Id:" Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="0" Height="23" HorizontalAlignment="Left" Margin="3" Name="idTextBox" Text="{Binding Path=Id, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="First Name:" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="1" Height="23" HorizontalAlignment="Left" Margin="3" Name="firstNameTextBox" Text="{Binding Path=FirstName, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Last Name:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="2" Height="23" HorizontalAlignment="Left" Margin="3" Name="lastNameTextBox" Text="{Binding Path=LastName, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            <Label Content="Web Site:" Grid.Column="0" Grid.Row="3" HorizontalAlignment="Left" Margin="3" VerticalAlignment="Center" />
            <TextBox Grid.Column="1" Grid.Row="3" Height="23" HorizontalAlignment="Left" Margin="3" Name="webSiteTextBox" Text="{Binding Path=WebSite, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" VerticalAlignment="Center" Width="120" />
            
        </Grid>
        <Grid  DataContext="{StaticResource authorsBooksViewSource}">
            <DataGrid AutoGenerateColumns="False" EnableRowVirtualization="True" Height="162" HorizontalAlignment="Left" ItemsSource="{Binding}" Margin="37,188,0,0" Name="booksDataGrid" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="451">
                <DataGrid.Columns>
                    <DataGridTextColumn x:Name="idColumn" Binding="{Binding Path=Id}" Header="Id" Width="SizeToHeader" Visibility="Collapsed" />
                    <DataGridTextColumn x:Name="isbnColumn" Binding="{Binding Path=Isbn}" Header="Isbn" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="notesColumn" Binding="{Binding Path=Notes}" Header="Notes" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="pageCountColumn" Binding="{Binding Path=PageCount}" Header="Page Count" Width="SizeToHeader" />
                    <DataGridTemplateColumn Header="Price">                        
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate >
                                <TextBlock  Text="{Binding Path=Price}"></TextBlock>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn x:Name="publicationDateColumn" Header="Publication Date" Width="SizeToHeader">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <DatePicker SelectedDate="{Binding Path=PublicationDate, Mode=TwoWay, ValidatesOnExceptions=true, NotifyOnValidationError=true}" />
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTextColumn x:Name="summaryColumn" Binding="{Binding Path=Summary}" Header="Summary" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="titleColumn" Binding="{Binding Path=Title}" Header="Title" Width="SizeToHeader" />
                    <DataGridTextColumn x:Name="authorIdColumn" Binding="{Binding Path=AuthorId}" Header="Author Id" Width="SizeToHeader" Visibility="Collapsed" />
                    <DataGridTextColumn x:Name="publisherIdColumn" Binding="{Binding Path=PublisherId}" Header="Publisher Id" Width="SizeToHeader" Visibility="Collapsed" />
                    <DataGridTextColumn x:Name="subjectIdColumn" Binding="{Binding Path=SubjectId}" Header="Subject Id" Width="SizeToHeader" Visibility="Collapsed" />
                </DataGrid.Columns>
                <DataGrid.RowDetailsTemplate>
                    <DataTemplate>
                        <Expander>
                            <StackPanel Orientation="Vertical">
                                <TextBox Text="{Binding Title}"> </TextBox>
                                <TextBox Text="{Binding Summary}"></TextBox>
                                <TextBox Text="{Binding Isbn}"></TextBox>
                            </StackPanel>
                        </Expander>
                    </DataTemplate>
                </DataGrid.RowDetailsTemplate>
            </DataGrid>
            <Grid Margin="248,31,12,318" DataContext="{Binding Source={StaticResource authorsViewSource}}">
                <Image Height="141" HorizontalAlignment="Left" Margin="6,4,0,0" Name="image1" Stretch="Fill" VerticalAlignment="Top" Width="228" Source="{Binding Path=Photo}" />
            </Grid>
        </Grid>
        
        
    </Grid>
</UserControl>
